{% extends 'base.html' %}
{% block content %}
<div class="container mt-4">
    <h2>网关管理</h2>
    <div class="mb-3">
        <a href="{% url 'gateway-create' %}" class="btn btn-primary">添加网关</a>
        <a href="{% url 'gateway-import-export' %}" class="btn btn-success">导入/导出</a>
    </div>
    
    <table class="table table-striped">
        <thead>
            <tr>
                <th>网关名称</th>
                <th>IP地址</th>
                <th>MAC地址</th>
                <th>安装位置</th>
                <th>状态</th>
                <th>操作</th>
            </tr>
        </thead>
        <tbody>
            {% for gateway in gateways %}
            <tr>
                <td>{{ gateway.name }}</td>
                <td>{{ gateway.ip_address }}</td>
                <td>{{ gateway.mac_address }}</td>
                <td>{{ gateway.location }}</td>
                <td>{{ gateway.status }}</td>
                <td>
                    <a href="{% url 'gateway-update' gateway.pk %}" class="btn btn-sm btn-warning">编辑</a>
                    <a href="{% url 'gateway-delete' gateway.pk %}" class="btn btn-sm btn-danger">删除</a>
                </td>
            </tr>
            {% endfor %}
        </tbody>
    </table>
</div>
{% endblock %}